/**
 * Created by devin on 2017/3/27.
 */

var  mongoose = require('mongoose');
// 连接mongodb
mongoose.connect('mongodb://localhost:27017/student')
// 实例化连接对象
var db = mongoose.connection;
db.on('error', console.error.bind(console, '连接错误：'))
db.once('open',function(){
    console.log('MongoDB连接成功！！')
});
// 创建schema
var classSchema = new mongoose.Schema({
    name: String,
    cid: String
});
var classSchema2 = new mongoose.Schema({
    phone: String,
    code: String,
    death:Boolean
});
// 创建model
var classModel = mongoose.model('student/students', classSchema) // newClass为创建或选中的集合
var classModel2 = mongoose.model('sms', classSchema2) // newClass为创建或选中的集合
exports.stu = classModel;
exports.sms = classModel2;